<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{$Think.config.WEB_TITLE}</title>
<script type="text/javascript">
var JS_PATH ="../Public/jqGrid/js/";
var URL = '__URL__';
var APP	 =	 '__APP__';
var PUBLIC = '__PUBLIC__';
var REQUEST_URI = '{$_SERVER.REQUEST_URI}';
var gridimgpath='../Public/jqGrid/themes/basic/images';
</script>
<link rel="stylesheet" type="text/css" media="screen" title="basic" href="../Public/jqGrid/themes/basic/grid.css" />
<script src="../Public/jqGrid/jquery.js" type="text/javascript"></script>
<script src="../Public/jqGrid/jquery.jqGrid.js" type="text/javascript"></script>
<script type="text/javascript">
// We use a document ready jquery function.

jQuery(document).ready(function(){
	jQuery("#ainsrow").jqGrid({
		url:'http://127.0.0.1/jgrid/server.php?q=1',
		datatype: "xml",
		colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
		colModel:[
		{name:'id',index:'id', width:55},
		{name:'invdate',index:'invdate', width:90},
		{name:'name',index:'name', width:100},
		{name:'amount',index:'amount', width:80, align:"right"},
		{name:'tax',index:'tax', width:80, align:"right"},
		{name:'total',index:'total', width:80,align:"right"},
		{name:'note',index:'note', width:150, sortable:false}
		],
		rowNum:10,
		rowList:[10,20,30],
		imgpath: gridimgpath,
		pager: jQuery('#painsrow'),
		sortname: 'id',
		viewrecords: true,
		sortorder: "desc",
		caption:"After insert row event",
		multiselect: true,
		afterInsertRow: function(rowid, aData){
			switch (aData.name) {
				case 'Client 1':
				jQuery("#ainsrow").setCell(rowid,'total','',{color:'green'});
				break;
				case 'Client 2':
				jQuery("#ainsrow").setCell(rowid,'total','',{color:'red'});
				break;
				case 'Client 3':
				jQuery("#ainsrow").setCell(rowid,'total','',{color:'blue'});
				break;

			}
		}
	}).navGrid('#painsrow',{edit:false,add:false,del:false});

});
</script>
</head>
<body>
<table id="ainsrow" class="scroll"></table>
<div id="painsrow" class="scroll" style="text-align:center;"></div>
</body>
</html>